package test.test05;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Main test = new Main();
//        test.myans1();
//        System.out.println(0^2);
        test.myans4();
    }

    public void myans1() {

        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        char[] strs = str.toCharArray();
        int n = strs.length;
        int maxNums = 0;
        int minNums = 0;
        for (int i = 0; i < n; i++) {
            if ('a' <= strs[i] && strs[i] <= 'z') {
                minNums++;
            } else {
                maxNums++;
            }
        }
        System.out.println(Math.abs(minNums - maxNums) / 2);

    }

    public void myans2(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for(int i = 0;i<n;i++){
            A[i] = sc.nextInt();
        }
        int[] B = new int[n];
//        System.out.println(B[0] = (A[0]^(1%1)) ^ (1%2));
        for(int i = 1;i<=n;i++){
            B[i-1] = A[i-1];
            for(int j = 1;j<=n;j++){
                B[i-1] ^= (i%j);
            }
        }
        int ans = 0;
        for(int i = 0;i<n;i++){
            ans ^= B[i];
        }
        System.out.println(ans);
    }

    public void myans3(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] nums = new char[n];
        int p = sc.nextInt();
        int q = sc.nextInt();
        int[] arrp = new int[p];
        int[] arrq = new int[q];

        for(int i = 0;i<p;i++){
            arrp[i] = sc.nextInt();
        }
        for(int j = 0;j<q;j++){
            arrq[j] = sc.nextInt();
        }

        for(int i = 0;i<p;i++){
            nums[arrp[i]-1] = 'P';
        }
        for(int i = 0;i<q;i++){
            if(nums[arrq[i]-1] == 'P'){
                nums[arrq[i]-1] = 'J';
            }else {
                nums[arrq[i]-1] = 'Q';
            }
        }
        int numP=0,numQ=0,numJ=0;
        for(int i = 0;i<n;i++){
            if(nums[i] == 'P'){
                numP++;
            }else if(nums[i] == 'Q'){
                numQ++;
            }else if(nums[i] == 'J'){
                numJ++;
            }
        }
        System.out.printf("%d %d %d",numP,numQ,numJ);
    }

    public void myans4(){
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int[] arr = new int[n];
            boolean flag = true;
            int sum = 0;
            for (int i = 0; i < n; i++) {
                arr[i] = scanner.nextInt();
                sum += arr[i];
                if (arr[i] == 2) {
                    flag = false;
                }
            }
            if (!flag) {
                System.out.println("NO");
                continue;
            }
            sum -= n;
            if (sum == n - 1) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}
